#include "sharemem.hpp"

int main()
{
    int shmid = creatnewshm();
    cout<<"申请共享内存成功"<<endl;
    sleep(2);//观察nattch的值

    char* poi = (char*)shmat(shmid,NULL,0);
    cout<<"关联共享内存成功"<<endl;
    sleep(2);//观察nattch的值

    shmdt(poi);
    cout<<"成功去关联共享内存"<<endl;
    sleep(2);//观察nattch的值

    shmctl(shmid,IPC_RMID,nullptr);
    cout<<"成功删除共享内存"<<endl;

    return 0;
}